package Others.DesignPattern.PrototypePattern.Pattern;

import Others.DesignPattern.PrototypePattern.Pattern.Object.Resume;
import Others.DesignPattern.PrototypePattern.Pattern.Object1.ShallowCloneResume;
import Others.DesignPattern.PrototypePattern.Pattern.Object1.ShallowWorkExperience;
import Others.DesignPattern.PrototypePattern.Pattern.Object2.DeepCloneResume;
import Others.DesignPattern.PrototypePattern.Pattern.Object2.DeepWorkExperience;

public class main2 {
    public static void main(String[] args) throws CloneNotSupportedException {

        //解下来进行深克隆--其实简单，就是对其内部的引用类型也实现克隆接口即可，在重写克隆方法及完成

        DeepCloneResume deepCloneResume = new DeepCloneResume("大鸟", "男", "29", new DeepWorkExperience("1998-2000", "阿里"));
        deepCloneResume.show();
        DeepCloneResume clonedeepCloneResumeA = (DeepCloneResume)deepCloneResume.clone();
        clonedeepCloneResumeA.setDeepWorkExperience("2000-2001", "腾讯");
        clonedeepCloneResumeA.setName("小鸟");
        clonedeepCloneResumeA.show();

        System.out.println();
        //查看第一份是否被更改
        deepCloneResume.show();

        //得出结论，深层克隆，相当于对内引用进行克隆，对外对象进行创建（new）--所以当内部引用创建繁琐时，就可以使用深层克隆

    }
}
